<template>
    <div>
        <div class="bg-white grid-content">
            <!-- <el-form :inline="true" :model="jyjqkbForm" class="demo-form-inline">

                <el-form-item label="日期:">
                    <el-date-picker v-model="searchDate" align="right" type="date" placeholder="请选择日期"
                        :picker-options="pickerOptions">
                    </el-date-picker>
                </el-form-item>

                <el-form-item>
                    <el-button type="primary">查询</el-button>
                    <el-button type="success">下载</el-button>
                </el-form-item>
            </el-form> -->

            <el-tabs v-model="activeName" type="card" @tab-click="handleMenuClick">
                <el-tab-pane label="积压井情况表" name="first"><!--积压井情况表界面-->
                  <el-select v-model="zyqvalue" placeholder="请选择作业区" style="margin-bottom: 20px" @change="userJumpChange">
                    <el-option
                      v-for="item in zyqOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                  <el-table :data="tableData" border style="width: 100%"
                            :header-cell-style="{ background: '#F5F7FA', color: '#909399' }" v-show="jyjqkbVisable">

                    <el-table-column type="index" align="center" label="序号"></el-table-column>
                    <el-table-column align="center" prop="rq" label="填表日期">
                    </el-table-column>
                    <el-table-column align="center" prop="zyqmc" label="作业区名称">
                    </el-table-column>

                    <el-table-column prop="id" align="center" label="检泵井">
                      <el-table-column align="center" prop="jbjjs" label="井数（口）"></el-table-column>
                      <el-table-column align="center" prop="jbjryx" label="日影响（t/d）"></el-table-column>
                    </el-table-column>

                    <el-table-column prop="id" align="center" label="积压井">
                      <el-table-column align="center" prop="jyjjs" label="井数（口）"></el-table-column>
                      <el-table-column align="center" prop="jyjryx" label="日影响（t/d）"></el-table-column>
                    </el-table-column>

                    <el-table-column prop="id" align="center" label="测压井">
                      <el-table-column align="center" prop="cyjjs" label="井数（口）"></el-table-column>
                      <el-table-column align="center" prop="cyjryx" label="日影响（t/d）"></el-table-column>
                    </el-table-column>

                    <el-table-column prop="id" align="center" label="措施井">
                      <el-table-column align="center" label="缝网压裂">
                        <el-table-column align="center" prop="fwyljs" label="井数（口）"></el-table-column>
                        <el-table-column align="center" prop="fwylryx" label="日影响（t/d）"></el-table-column>
                      </el-table-column>

                      <el-table-column align="center" label="邻井封井/套管调查">
                        <el-table-column align="center" prop="ljfjjs" label="井数（口）"></el-table-column>
                        <el-table-column align="center" prop="ljfjryx" label="日影响（t/d）"></el-table-column>
                      </el-table-column>

                      <el-table-column align="center" label="措施配合">
                        <el-table-column align="center" prop="csphjs" label="井数（口）"></el-table-column>
                        <el-table-column align="center" prop="csphryx" label="日影响（t/d）"></el-table-column>
                      </el-table-column>
                    </el-table-column>
                  </el-table>
                </el-tab-pane>
                <el-tab-pane label="正处理" name="second"><!--正处理界面-->
                  <el-select v-model="zyqvalue" placeholder="请选择作业区" style="margin-bottom: 20px" @change="userJumpChange">
                    <el-option
                      v-for="item in zyqOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                  <el-table :data="tableData" border style="width: 100%"
                            :header-cell-style="{ background: '#F5F7FA', color: '#909399' }" v-show="zclVisable">
                    <el-table-column align="center" label="正处理">
                      <el-table-column align="center" type="index" prop="zcl_xh" label="序号"></el-table-column>
                      <el-table-column align="center" prop="rq" label="填表日期">
                      </el-table-column>
                      <el-table-column align="center" prop="zyqmc" label="作业区名称">
                      </el-table-column>
                      <el-table-column align="center" prop="xdmc" label="小队"></el-table-column>

                      <el-table-column align="center" prop="jmc" label="井名称"></el-table-column>

                      <el-table-column align="center" prop="sgrq" label="施工日期"></el-table-column>

                      <el-table-column align="center" prop="ryx" label="日影响(t/d)"></el-table-column>

                      <el-table-column align="center" prop="jyyy" label="积压原因"></el-table-column>

                      <el-table-column align="center" prop="sgcs" label="施工措施"></el-table-column>

                      <el-table-column align="center" prop="sgjd" label="目前进度"></el-table-column>

                      <el-table-column align="center" prop="bz" label="备注"></el-table-column>
                    </el-table-column>
                  </el-table>
                </el-tab-pane>
                <el-tab-pane label="待处理" name="third"><!--待处理界面-->
                  <el-select v-model="zyqvalue" placeholder="请选择作业区" style="margin-bottom: 20px" @change="userJumpChange">
                    <el-option
                      v-for="item in zyqOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                  <el-table :data="tableData" border style="width: 100%"
                            :header-cell-style="{ background: '#F5F7FA', color: '#909399' }" v-show="dclVisable">
                    <el-table-column align="center" label="待处理">
                      <el-table-column align="center" type="index" prop="zcl_xh" label="序号"></el-table-column>
                      <el-table-column align="center" prop="rq" label="填表日期">
                      </el-table-column>
                      <el-table-column align="center" prop="zyqmc" label="作业区名称">
                      </el-table-column>
                      <el-table-column align="center" prop="xdmc" label="小队"></el-table-column>

                      <el-table-column align="center" prop="jmc" label="井名称"></el-table-column>

                      <el-table-column align="center" prop="sgrq" label="积压日期"></el-table-column>

                      <el-table-column align="center" prop="ryx" label="日影响(t/d)"></el-table-column>

                      <el-table-column align="center" prop="jyyy" label="挤压原因"></el-table-column>

                      <el-table-column align="center" prop="sgcs" label="下步措施"></el-table-column>

                      <el-table-column align="center" prop="sgjd" label="目前进度"></el-table-column>

                      <el-table-column align="center" prop="bz" label="备注"></el-table-column>
                    </el-table-column>
                  </el-table>
                </el-tab-pane>
                <el-tab-pane label="措施配合" name="fourth"><!--措施配合界面-->
                  <el-select v-model="zyqvalue" placeholder="请选择作业区" style="margin-bottom: 20px" @change="userJumpChange">
                    <el-option
                      v-for="item in zyqOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                  <el-table :data="tableData" border style="width: 100%"
                            :header-cell-style="{ background: '#F5F7FA', color: '#909399' }" v-show="csphVisable">
                    <el-table-column align="center" label="措施配合">
                      <el-table-column align="center" type="index" prop="zcl_xh" label="序号"></el-table-column>
                      <el-table-column align="center" prop="rq" label="填表日期">
                      </el-table-column>
                      <el-table-column align="center" prop="zyqmc" label="作业区名称">
                      </el-table-column>
                      <el-table-column align="center" prop="xdmc" label="小队"></el-table-column>

                      <el-table-column align="center" prop="jmc" label="井名称"></el-table-column>

                      <el-table-column align="center" prop="sgrq" label="施工日期"></el-table-column>

                      <el-table-column align="center" prop="ryx" label="日影响(t/d)"></el-table-column>

                      <el-table-column align="center" prop="jyyy" label="挤压原因"></el-table-column>

                      <el-table-column align="center" prop="sgcs" label="施工措施"></el-table-column>

                      <el-table-column align="center" prop="sgjd" label="目前进度"></el-table-column>

                      <el-table-column align="center" prop="bz" label="备注"></el-table-column>
                    </el-table-column>
                  </el-table>
                </el-tab-pane>
                <el-tab-pane label="测静压" name="fifth"> <!--测静压界面-->
                  <el-select v-model="zyqvalue" placeholder="请选择作业区" style="margin-bottom: 20px" @change="userJumpChange">
                    <el-option
                      v-for="item in zyqOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                  <el-table :data="tableData" border style="width: 100%"
                            :header-cell-style="{ background: '#F5F7FA', color: '#909399' }" v-show="cjyVisable">
                    <el-table-column align="center" label="测静压">
                      <el-table-column align="center" type="index" prop="zcl_xh" label="序号"></el-table-column>
                      <el-table-column align="center" prop="rq" label="填表日期">
                      </el-table-column>
                      <el-table-column align="center" prop="zyqmc" label="作业区名称">
                      </el-table-column>
                      <el-table-column align="center" prop="xdmc" label="小队"></el-table-column>

                      <el-table-column align="center" prop="jmc" label="井名称"></el-table-column>

                      <el-table-column align="center" prop="sgrq" label="测压日期"></el-table-column>

                      <el-table-column align="center" prop="ryx" label="日影响(t/d)"></el-table-column>
                    </el-table-column>
                  </el-table>
                </el-tab-pane>
                <el-tab-pane label="缝网压裂" name="sixth">
                  <el-select v-model="zyqvalue" placeholder="请选择作业区" style="margin-bottom: 20px" @change="userJumpChange">
                    <el-option
                      v-for="item in zyqOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                  <el-table :data="tableData" border style="width: 100%"
                            :header-cell-style="{ background: '#F5F7FA', color: '#909399' }" v-show="fwylVisable">
                    <el-table-column align="center" label="缝网压裂">
                      <el-table-column align="center" type="index" prop="zcl_xh" label="序号"></el-table-column>
                      <el-table-column align="center" prop="rq" label="填表日期">
                      </el-table-column>
                      <el-table-column align="center" prop="zyqmc" label="作业区名称">
                      </el-table-column>

                      <el-table-column align="center" prop="xdmc" label="小队"></el-table-column>

                      <el-table-column align="center" prop="jmc" label="井名称"></el-table-column>

                      <el-table-column align="center" prop="sgrq" label="施工日期"></el-table-column>

                      <el-table-column align="center" prop="ryx" label="日影响(t/d)"></el-table-column>
                    </el-table-column>
                  </el-table></el-tab-pane>
            </el-tabs>
        </div>
    </div>
</template>

<script>
import jyjclyxhzApi from "@/api/jyjclyxhz";

export default {
    data() {
        return {
            zyqOptions: [{
              value: '第一作业区',
              label: '第一作业区'
            }, {
              value: '第二作业区',
              label: '第二作业区'
            }, {
              value: '第三作业区',
              label: '第三作业区'
            },{
              value: '第四作业区',
              label: '第四作业区'
            },{
              value: '第五作业区',
              label: '第五作业区'
            },{
              value: '肇一',
              label: '肇一'
            },{
              value: '肇二',
              label: '肇二'
            },{
              value: '肇25',
              label: '肇25'
            },{
              value: '升22',
              label: '升22'
            }],

          //数据总条数
          total: 0,
          //当前页码
          pageNo: 1,
          // 分页数
          pageSize: 5,

          startDate: "",
          endDate: "",
          searchDate: "",

          zyqvalue:"第一作业区",

          currentPageName: "总览",

          activeName: "first",

          //时间快捷选择
          pickerOptions: {
              disabledDate(time) {
                  return time.getTime() > Date.now();
              },
              shortcuts: [
                  {
                      text: "今天",
                      onClick(picker) {
                          picker.$emit("pick", new Date());
                      },
                  },
                  {
                      text: "昨天",
                      onClick(picker) {
                          const date = new Date();
                          date.setTime(date.getTime() - 3600 * 1000 * 24);
                          picker.$emit("pick", date);
                      },
                  },
                  {
                      text: "一周前",
                      onClick(picker) {
                          const date = new Date();
                          date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
                          picker.$emit("pick", date);
                      },
                  },
              ],
          },

          tableData: [],

          //积压井情况表总览的可见性
          jyjqkbVisable: true,

          //正施工容器区的可见性
          zclVisable: false,

          //待施工的可见性
          dclVisable: false,

          //措施配合可见性
          csphVisable: false,

          //测静压可见性
          cjyVisable: false,

          //缝网压裂可见性
          fwylVisable: false,
        };
    },
    created() {
      this.search();
      // this.reload();
      // //this.exportExcel();
    },
    methods: {
      async search() {
        this.tableData=[]
        var res=null
        if (this.activeName === "first") {
          res = await jyjclyxhzApi.getYjqkListByZyq(
            this.pageNo,
            this.pageSize,
            this.zyqvalue,
            this.searchDate[0],
            this.searchDate[1]
          );
          this.tableData = res.data.records;
          console.log(this.tableData)
        } else if (this.activeName === "second") {
          res = await jyjclyxhzApi.geYjByZtListByZyq(
            this.pageNo,
            this.pageSize,
            "正处理",
            this.zyqvalue,
            this.searchDate[0],
            this.searchDate[1]
          );
          this.tableData = res.data.records;
        } else if (this.activeName === "third") {
          res = await jyjclyxhzApi.geYjByZtListByZyq(
            this.pageNo,
            this.pageSize,
            "待处理",
            this.zyqvalue,
            this.searchDate[0],
            this.searchDate[1]
          );
          this.tableData = res.data.records;
        } else if (this.activeName === "fourth") {
          res = await jyjclyxhzApi.geYjByZtListByZyq(
            this.pageNo,
            this.pageSize,
            "措施配合",
            this.zyqvalue,
            this.searchDate[0],
            this.searchDate[1]
          );
          this.tableData = res.data.records;
        }else if(this.activeName === "fifth"){
          res = await jyjclyxhzApi.getYjByJxListByZyq(
            this.pageNo,
            this.pageSize,
            "测静压",
            this.zyqvalue,
            this.searchDate[0],
            this.searchDate[1]
          );
          this.tableData = res.data.records;
        }else if(this.activeName === "sixth"){
          res = await jyjclyxhzApi.getYjByJxListByZyq(
            this.pageNo,
            this.pageSize,
            "缝网压裂",
            this.zyqvalue,
            this.searchDate[0],
            this.searchDate[1]
          );
          this.tableData = res.data.records;
        }
        this.total = res.data.total;
        this.pageSize = res.data.size;
      },
      onSubmit() {
          console.log("submit!");
      },
      uploadData() {
          console.log("批量导入成功");
      },
      // //每页条数改变时触发 选择一页显示多少行
      // handleSizeChange(val) {
      //     console.log(`每页 ${val} 条`);
      //     this.currentPage = 1;
      //     this.pageSize = val;
      // },
      // //当前页改变时触发 跳转其他页
      // handleCurrentChange(val) {
      //     console.log(`当前页: ${val}`);
      //     this.currentPage = val;
      // },
      // 序号计算
      indexMethod(index) {
          // index默认在0开始，这里+1
          return index + 1 + (this.currentPage - 1) * this.pageSize;
      },

      //Tab标签区域切换按钮事件
      handleMenuClick(tab, event) {
          var content = event.target.innerText;
          if (content === "积压井情况表") {
              this.currentPageName = "积压井情况表";
              this.jyjqkbVisable = true;
              this.zclVisable = false;
              this.dclVisable = false;
              this.csphVisable = false;
              this.cjyVisable = false;
              this.fwylVisable = false;
          } else if (content === "正处理") {
              this.currentPageName = "正处理";
              this.jyjqkbVisable = false;
              this.zclVisable = true;
              this.dclVisable = false;
              this.csphVisable = false;
              this.cjyVisable = false;
              this.fwylVisable = false;
          } else if (content === "待处理") {
              this.currentPageName = "待处理";
              this.jyjqkbVisable = false;
              this.zclVisable = false;
              this.dclVisable = true;
              this.csphVisable = false;
              this.cjyVisable = false;
              this.fwylVisable = false;
              this.zongheshujuVisable = false;
          } else if (content === "措施配合") {
              this.currentPageName = "措施配合";
              this.jyjqkbVisable = false;
              this.zclVisable = false;
              this.dclVisable = false;
              this.csphVisable = true;
              this.cjyVisable = false;
              this.fwylVisable = false;
          }
          else if (content === "测静压") {
              this.currentPageName = "测静压";
              this.jyjqkbVisable = false;
              this.zclVisable = false;
              this.dclVisable = false;
              this.csphVisable = false;
              this.cjyVisable = true;
              this.fwylVisable = false;
          }
          else if (content === "缝网压裂") {
              this.currentPageName = "缝网压裂";
              this.jyjqkbVisable = false;
              this.zclVisable = false;
              this.dclVisable = false;
              this.csphVisable = false;
              this.cjyVisable = false;
              this.fwylVisable = true;
          }
          console.log(this.currentPageName);
          this.search()
      },
      userJumpChange(){
        this.search()
      },
    },
};
</script>

<style lang="scss" scoped>
// 标题
.mytitle {
    font-size: large;
    padding-left: 10px;
    margin-bottom: 16px;
    float: left;
}

//按钮组
.myButtons {
    float: right;
}

//格子的样式
.bg-white {
    background: #ffffff;
}

.grid-content {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.calendar ::v-deep .el-button-group::before {
    display: none;
}

.calendar ::v-deep .el-button-group::after {
    display: none;
}

// 分割线样式
.el-divider--horizontal {
    display: block;
    height: 2px;
    width: 100%;
    margin: 24px 0;
}

// 表单各项的样式
.el-form-item {
    margin: 15px 10px 15px 10px;
}
</style>
